package com.module.my.utils

import android.content.Context
import android.content.Intent
import android.widget.Toast
import com.module.app.base.BaseApplication
import com.module.app.ext.notNull
import com.module.app.utils.UserUtils
import com.module.my.view.*

fun Context?.startProblem() {
    notNull({
        it.startActivity(Intent(this, ProblemActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startAutoSkinNight() {
    notNull({
        it.startActivity(Intent(this, AutoSkinNightActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startSet() {
    notNull({
        it.startActivity(Intent(this, SetActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startSkin() {
    notNull({
        it.startActivity(Intent(this, SkinActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startVip() {
    notNull({
        it.startActivity(Intent(this, VipActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}

fun Context?.startUser() {
    notNull({
        if (!com.module.app.utils.UserUtils.isLogin(true)) {
            return
        }
        it.startActivity(Intent(this, UserInfoActivity::class.java))
    }, {
        Toast.makeText(com.module.app.base.BaseApplication.getContext(), "启动异常", Toast.LENGTH_LONG).show()
    })
}


